Skip to content

Conversation

@yashksaini-coder
Copy link
Owner

Pull Request Template

Summary

This pull request includes several changes to improve the reliability of redirection and handling of authenticated routes in the application. The changes focus on ensuring proper authentication state detection and avoiding redirect loops.

Improvements to redirection:

  • store/AuthStore/useAuthStore.ts: Replaced router.push with window.location.href for redirection after login and logout to ensure the middleware properly detects the authentication state. [1] [2]

Enhancements to authentication middleware:

  • utils/supabase/middleware.ts: Added a check to redirect unauthenticated users to the signin page when accessing protected routes.
  • utils/supabase/middleware.ts: Implemented a mechanism to redirect authenticated users away from auth pages by adding a cache-busting parameter to avoid redirect loops.

yashksaini-coder added 2 commits March 3, 2025 21:21
@yashksaini-coder yashksaini-coder added the Backend Related to the Backend part label Mar 3, 2025
@yashksaini-coder yashksaini-coder self-assigned this Mar 3, 2025
@vercel
Copy link

vercel bot commented Mar 3, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
leetcode-journal ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 3, 2025 4:01pm

@yashksaini-coder yashksaini-coder merged commit 8f9a59a into main Mar 3, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backend Related to the Backend part

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants